package com.tuo51.core.domain.ppp;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.tuo51.foudation.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

@Entity
@Data
@Table(name = "p_role")
@EqualsAndHashCode(callSuper = true)
@JsonIgnoreProperties({"handler", "hibernateLazyInitializer"})
public class Role extends Domain {

    @Column(columnDefinition = "varchar(50) COMMENT '角色名'")
    private String roleName;

    @Column(columnDefinition = "varchar(50) COMMENT '角色码'")
    private String roleCode;

    @Column(columnDefinition = "varchar(50) COMMENT '描述'")
    private String description;

    @Column(columnDefinition = "varchar(32) COMMENT '所属系统'")
    private String platformId;

//    @Column(columnDefinition = "bit default false COMMENT '是否开放'")
//    private Boolean isRoot = false;

    @Column(columnDefinition = "int  COMMENT '排序'")
    private Integer orderNum;

    public static Role of(String roleName, String roleCode, String description, String platformId) {
        Role role = new Role();
        role.setRoleName(roleName);
        role.setRoleCode(roleCode);
        role.setDescription(description);
        role.setPlatformId(platformId);
        return role;
    }
}
